<%--
  Created by IntelliJ IDEA.
  User: chensui
  Date: 2016/12/15
  Time: 16:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<% String contexts = request.getContextPath();
    pageContext.setAttribute("ctx", contexts);
%>
<head>
    <link type="text/css" rel="stylesheet" href="${ctx}/css/login/comment/commentCss.css">
    <link rel="stylesheet" href="https://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <script type="text/javascript" src="${ctx}/js/jquery-3.1.1.min.js"></script>
    <script type="text/javascript" src="${ctx}/js/bootstrap.min.js"></script>
    <script type="text/javascript">
        var ctx = '${ctx}';
    </script>
    <script type="text/javascript" src="${ctx}/js/login/category/listCategory.js"></script>

    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib uri="/struts-tags" prefix="s" %>
    <title></title>
</head>
<body>
<div class="listMain" id="listCate">
    <h2 class="page-header">所有评论显示</h2>

    <div class="table-responsive">
        <table class="table table-striped">
            <thead>
            <tr>
                <th id="th1">评论者</th>
                <th id="th2">评论内容</th>
                <th id="th3">评论时间</th>
                <th id="th4">点赞</th>
                <th id="th5">操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${pages.list }" var="commentVO">
                <tr>
                    <td>${commentVO.reviewers }</td>
                    <td>${commentVO.commentContent }</td>
                    <td>${commentVO.commentTime }</td>
                    <td>${commentVO.top }</td>

                    <td><a href="${ctx }/loadComment.action?categoryId=${commentVO.commentId}">查看</a> ||
                        <a href="${ctx }/deleteComment.action?categoryId=${commentVO.commentId}">删除</a></td>
                    </td>

                </tr>
            </c:forEach>

            </tbody>
        </table>
    </div>
    <nav>
        <s:form id="pageForm" action="" namespace="/">
            <ul class="pagination">
                <c:set value="${pages}" var="p"></c:set>
                <c:set value="${ctx}/login/execute.action}" var="path"></c:set>
                <li><a href="javascript:void(0)" id="beginPage" onclick="beginPage()">&laquo;首页
                </a></li>

                <c:if test="${p.currentPage ge 3}">
                    <li><a href="javascript:void(0)" id="preTwoPage"
                           onclick="preTwoPage()">${p.currentPage - 2}
                    </a></li>
                </c:if>

                <c:if test="${p.currentPage ge 2}">
                    <li><a href="javascript:void(0)" id="preOnePage"
                           onclick="preOnePage()">${p.currentPage - 1}
                    </a></li>
                </c:if>

                <li class="active"><a href="javascript:void(0)" id="currentPage"
                                      onclick="currentPage()">${p.currentPage}
                    <span class="sr-only">(current)</span>
                    <input type="hidden" value="${p.currentPage}" name="pages.currentPage"></a></li>

                <c:if test="${p.currentPage le p.totalPage -1}">
                    <li><a href="javascript:void(0)" id="nextOnePage"
                           onclick="nextOnePage()">${p.currentPage+1}
                    </a></li>
                </c:if>


                <c:if test="${p.currentPage le p.totalPage -2}">
                    <li><a href="javascript:void(0)" id="nextTwoPage"
                           onclick="nextTwoPage()">${p.currentPage + 2}
                    </a></li>
                </c:if>

                <li><a href="javascript:void(0)" id="endPage" onclick="endPage();">尾页&raquo;
                    <input type="hidden" value="${p.totalPage}" name="pages.totalPage"></a></li>
            </ul>
        </s:form>
    </nav>
</div>


</body>
</html>
